//编辑专业的专业名
function edit(e){
	var e = e || event ;
	var a = e.srcElement || e.target || e ;
	var tr = a.parentNode.parentNode;
	var tds = tr.childNodes;
	var tempTds = [];
	for(var i=0 ; i<tds.length ; i++){
		if(tds[i].nodeType==1){
			tempTds.push(tds[i]);
		}
	}
	tds = tempTds ;
	var td_name = tds[1];
	var value_name = td_name.innerHTML ;
	td_name.innerHTML = "";
	var input_name = document.createElement("input");
	input_name.className = "inputEdit";
	input_name.type = "text";
	input_name.value = value_name ;
	td_name.appendChild(input_name);
	a.innerHTML = "修改";
	a.onclick = updateprofession;
	input_name.focus();
}
//修改专业名
function updateprofession(e){
	var e = e||event ;
	var a = e.srcElement || e.originalTarget ;
	var tr = a.parentNode.parentNode;
	var tds = tr.childNodes;
	var tempTds = [];
	for(var i=0 ; i<tds.length ; i++){
		if(tds[i].nodeType==1){
			tempTds.push(tds[i]);
		}
	}
	tds = tempTds ;
	var nametmp = tds[1].firstChild.value ;
	$.ajax({
		type:"post",
		url:"./profession/profession!updateprofession.action",
		data:{name:nametmp,id:a.getAttribute("proId"),n:Math.random()},
		success:function(msg){
			tds[1].innerHTML= nametmp;
		}					
	});
	a.innerHTML = "编辑";
	a.onclick = edit ;	
}
////显示专业下班级
//function showclasses(e){
//	var e = e || event ;
//	var a = e.srcElement || e.target || e ;
//	var tr = a.parentNode.parentNode;
//	var table = document.getElementById("tblprofession");
//	var row = table.insertRow(tr.rowIndex+1);
//	var cell = row.insertCell(0);
//	cell.colSpan = "4";
//	$.ajax({
//		type:"post",
//		url:"proClasses!showcla.action",
//		data:{pid:a.getAttribute("proId"),n:Math.random()},
//		success:function(msg){
//			cell.innerHTML = msg ;
//		}					
//	});
//	a.innerHTML = "隐藏班级";
//	a.onclick = hideClasses ;
//}
//function hideClasses(e){
//	var e = e || event ;
//	var a = e.srcElement || e.target || e;
//	var tr = a.parentNode.parentNode;
//	var table = document.getElementById("tblprofession");
//	table.deleteRow(tr.rowIndex+1);
//
//	a.innerHTML = "显示班级"; 
//	a.onclick = showclasses ;
//}
////删除专业
//function deletepro(pid){
//	$.ajax({
//		type:"post",
//		url:"prodelete!deletePro.action",
//		data:{id:pid,n:Math.random()},
//		success:function(msg){
//			location.href="showprofession!show.action?n="+Math.random();
//		}					
//	});
//}